<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
 String basePath = request.getContextPath();
 String path = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+basePath+"/";
 %>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>普惠电商 | 登录</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css">
  <link href="${pageContext.request.contextPath}/static/dist/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
  <link href="${pageContext.request.contextPath}/static/dist/css/ionicons.min.css" rel="stylesheet" type="text/css"/>
  <!-- Theme style -->
  <link rel="stylesheet" href="${pageContext.request.contextPath}/static/dist/css/AdminLTE.min.css">
  <link href="${pageContext.request.contextPath}/static/plugins/validationEngine/css/validationEngine.jquery.css" rel="stylesheet" type="text/css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
  
</head>
<body class="hold-transition login-page">
<div class="login-box">
  <div class="login-logo">
    <b>普惠电商后台系统</b>
  </div>
  <!-- /.login-logo -->
  <div class="login-box-body">
    <p class="login-box-msg">用户登录</p>
    <form id="loginForm" action="${pageContext.request.contextPath}/doLogin" method="POST">
      <div class="form-group has-feedback">
        <input type="mobile" name="telphone" class="form-control validate[required,custom[phone]" placeholder="手机号码">
        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" name="password" id="password" class="form-control validate[required]" placeholder="登录密码">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      <div class="row" style="margin-left: 75px;">
        <!-- /.col -->
        <div class="col-xs-4" >
         	<button type="submit" id="loginBtn" class="btn btn-primary btn-block btn-flat" style="width:150px;">登    录</button>
        </div>
        <!-- /.col -->
      </div>
    </form>
  </div>
  <br>
  <br>
  <c:if test="${not empty msg and code!='200'}">
	  <div class="footer" id="msg">
	 		<div class="alert alert-danger alert-dismissable">
	            <i class="fa fa-info"></i>
	        	 ${msg}
	        </div>
	   </div>
	   <script type="text/javascript">
			setTimeout('$("#msg").hide("slow")',3000);
	   </script>
  </c:if>
  <!-- /.login-box-body -->
</div>

<!-- /.login-box -->
<!-- jQuery 2.1.4 -->
<script src="${pageContext.request.contextPath}/static/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- md5 -->
<script src="${pageContext.request.contextPath}/static/plugins/md5/jquery.md5.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/static/plugins/validationEngine/jquery.validationEngine-zh_CN.js"></script>
<script src="${pageContext.request.contextPath}/static/plugins/validationEngine/jquery.validationEngine.js"></script>
<script>
$(function(){
	if(window != top){
		top.location.href=location.href;
	}
	
	$("input[type='mobile'] ").val("")
	$("input[type='password'] ").val("")
	
	$("#loginForm").validationEngine({ 
		promptPosition: "topRight", 
		validationEventTriggers:"keyup blur", 
		success :  false,
		failure : function() { callFailFunction()  }
	});
	$("#loginBtn").click(function(){
		var flag = $("#loginForm").validationEngine("validate");
		if(!flag){
	 		return false;
		}
		var md5=$.md5($("#password").val());
		$("#password").val(md5);
	});
	$("#loginForm").submit();
});
</script>
</body>
</html>
